package redis

import (
	"context"
	"github.com/go-redis/redis/v8"
)

var Rdb *redis.Client

func RedisInit(addr string, password string, Db int) *redis.Client {
	Rdb = redis.NewClient(&redis.Options{
		Addr:     addr,
		Password: password,
		DB:       Db,
	})
	err := Rdb.Ping(context.Background()).Err()
	if err != nil {
		panic(err)
	}
	return Rdb
}
